﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class notice_add_notice : System.Web.UI.Page
{
    DataClassesDataContext db1 = new DataClassesDataContext();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack == true)
        {
            Label8.Text = Session["name"].ToString();
            string Date = DateTime.Now.ToString("yyyy-MM-dd");
            Label9.Text = Date.Substring(0, 4) + "年" + Date.Substring(5, 2) + "月" + Date.Substring(8, 2) + "日";
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string content = FreeTextBox1.Text;
        string theme = TextBox1.Text;
        string Date = DateTime.Now.ToString("yyyy-MM-dd");
        db1.proc_AddNotic(Session["username"].ToString(), Date, theme, content, "");
        db1.SubmitChanges();
        Response.Write("<script>alert('公告提交成功'！);</script>");
        Response.Redirect("notice.aspx");
    }
}